<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        *{
            margin: 0;
            padding:0;
        }
        .box{
            width: 100px;
            height: 100px;
            padding: 0 10px;
            background-color: red;
        }
        .demo{
            box-sizing: border-box;
            height: 20px;
            background-color: green;
            margin-left: 10px;
            margin-right: 10px;
        }
    </style>
</head>
<body>
<div class="box">
    <div class="demo"></div>
</div>
</body>
</html>